<?php
namespace app\modules\v1\controllers;
use Yii;
use yii\rest\ActiveController;
use yii\web\Response;
use app\modules\v1\models\ThreeElementsQueryLog;

class ThreeelementController extends ActiveController
{
	
    public $modelClass = 'app\modules\v1\models\ThreeElementsQueryLog';
    
    public function actions()
    {
        $actions = parent::actions();
        unset($actions['index'], $actions['update'], $actions['create'], $actions['delete'], $actions['view']);
        return $actions;
    }

    public function actionCreate()
    {
    	if(Yii::$app->request->isPost){
    		$authName 	= isset(Yii::$app->request->post()['authName'])?Yii::$app->request->post()['authName']:'';
    		$authId 	= isset(Yii::$app->request->post()['authId'])?Yii::$app->request->post()['authId']:'';
    		$bankCode 	= isset(Yii::$app->request->post()['bankCode'])?Yii::$app->request->post()['bankCode']:'';
    		$openid 	= isset(Yii::$app->request->post()['openId'])?Yii::$app->request->post()['openId']:'';
    		$threeelement = new ThreeElementsQueryLog();
    		$res = $threeelement->CheckThree($authName, $authId, $bankCode, $openid);
    		$res['code'] = $res['code'];
    		$res['msg']  = $res['msg'];
    		$response=Yii::$app->response;
    		$response->format=Response::FORMAT_JSON;
    		$response->data=$res;
    		return $response;
    	}else{
    		$res['code'] = '10400';
    		$res['msg']  = '身份证号、姓名、银行卡号不一致';
    		$response=Yii::$app->response;
    		$response->format=Response::FORMAT_JSON;
    		$response->data=$res;
    		return $response;
    	}
    }

}